local skel = fk.CreateSkill {
  name = "emo__fenxiang",
}

Fk:loadTranslationTable{
  ["emo__fenxiang"] = "分享",
  [":emo__fenxiang"] = "一名角色受到属性伤害后，你可以令其摸一张牌并交给你一张牌。",

  ["#emo__fenxiang-ask"] = "分享:你可以令 %src 摸一张牌并交给你一张牌",
  ["#emo__fenxiang-give"] = "分享:交给 %src 一张牌",
}

skel:addEffect(fk.Damaged, {
  anim_type = "drawcard",
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(skel.name) and not target.dead and data.damageType ~= fk.NormalDamage
  end,
  on_cost = function (self, event, target, player, data)
    return player.room:askToSkillInvoke(player, {skill_name = skel.name, prompt = "#emo__fenxiang-ask:"..target.id })
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    target:drawCards(1, skel.name)
    if player.dead or target.dead or target:isNude() or target == player then return end
    local cards = room:askToCards(target, {
      min_num = 1, max_num = 1, include_equip = true, cancelable = false, skill_name = skel.name,
      prompt = "#emo__fenxiang-give:"..player.id,
    })
    room:obtainCard(player, cards, false, fk.ReasonGive, target, skel.name)
  end,
})

return skel
